package com.slofzx.nuoda.evaluation.project.enums;

import com.slofzx.nuoda.common.EnumConfig;
import com.slofzx.nuoda.common.config.Type;

/**
 * 成本评价方法类型枚举
 * @author sunhaifeng
 */
@EnumConfig(
    id = "cost-eva-method",
    name = "成本评价方法类型"
)
public enum CostEvaMethodEnum implements Type {
    WELL_QUOTA("well_quota", "单井定额",1),
    COST_DETAIL("cost_detail", "成本构成",2),
    OIL_QUOTA("oil_quota", "吨油定额",3),
    FIX_VARIABLE("fix_Variable", "固定可变",4);

    /**
     * 标识
     */
    private String id;
    /**
     * 名称
     */
    private String name;
    /**
     * 排序值
     */
    private double sort;

    CostEvaMethodEnum(String id, String name, double sort) {
        this.id = id;
        this.name = name;
        this.sort = sort;
    }

    @Override
    public String getId() {
        return this.id;
    }

    @Override
    public String getName() {
        return this.name;
    }

    /**
     * 根据标识获取枚举值
     * @param id
     * @return
     */
    public static CostEvaMethodEnum getEnum(String id) {
        for(CostEvaMethodEnum item:values()) {
            if (item.getId().equals(id)) {
                return item;
            }
        }
        return null;
    }

    /**
     * 根据名称获取枚举值
     * @param name
     * @return
     */
    public static CostEvaMethodEnum getEnumByName(String name) {
        for(CostEvaMethodEnum item:values()) {
            if (item.getName().equals(name)) {
                return item;
            }
        }
        return null;
    }

}
